<?php
use_helper('Text');
class Custom {
    public static function slugify($text) {
        $text = preg_replace('/\W+/', '-', $text);

        $text = strtolower(trim($text, '-'));

        return $text;
    }

    public static function getShortText($text) {
        //$text = str_replace(array('<p>', '</p>'), ' ', $text);
        //$text = str_replace('039;', '\'', $text);
        $parole = split("[][ ',.;:?!\"{()}]", $text);
        $num = count($parole);
        if($num < 40) {
            return false;
        } else {
            preg_match("/([\S]+\s*){0,30}/", $text, $regs);
            return trim($regs[0]).'...';
        }
    }
}
?>
